package com.lry.rpc.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RpcServiceBean {

    private String version;
    private String group;
    private int weight;
    private Object ref;
    private String interfaceName;
    private Class<?> interfaceClass;
    private String serviceImplName;
    private String token;

    public static RpcServiceBean buildRpcServiceBean(Object ref){

        Class interfaceClazz = ref.getClass().getInterfaces()[0];

        return RpcServiceBean.builder().version("").group("").weight(1).ref(ref).
                interfaceName(interfaceClazz.getName()).
                interfaceClass(interfaceClazz).
                serviceImplName("").build();
    }

}
